#include <57header.h>

/* Usage: ./06_readstr file */
int main(int argc, char *argv[]){
    ARGS_CHECK(argc, 2);
    int fd = open(argv[1], O_RDWR);
    ERROR_CHECK(fd, -1, "open");
    char buf[1024] = {0};
    int count = read(fd, buf, sizeof(buf)-1);
    ERROR_CHECK(count, -1, "read");
    puts(buf);
    int num;
    sscanf(buf, "%d", &num);
    printf("num = %d\n", num);

    close(fd);
    return 0;
}

